﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Defector
{
    /// <summary>
    /// Interaction logic for Graphs.xaml
    /// </summary>
    public partial class Graphs : Window
    {
        int total = 0;
        int open = 0;
        int closed = 0;
        int assigned = 0;
        int unassigned = 0;
        int critical = 0;
        int high = 0;
        int medium = 0;
        int low = 0;

        public Graphs(int total, int assigned, int unassigned, int open, int closed, int critical, int high, int medium, int low)
        {
            InitializeComponent();

            this.total = total;
            this.assigned = assigned;
            this.unassigned = unassigned;
            this.open = open;
            this.closed = closed;
            this.critical = critical;
            this.high = high;
            this.medium = medium;
            this.low = low;

            allChart.DataContext = new KeyValuePair<string, int>[] {
                                    new KeyValuePair<string, int>("Total", total),
                                    new KeyValuePair<string, int>("Open", open),
                                    new KeyValuePair<string, int>("Closed", closed),
                                    new KeyValuePair<string, int>("Assigned", assigned),
                                    new KeyValuePair<string, int>("Unassigned", unassigned),
                                    new KeyValuePair<string, int>("Critical", critical),
                                    new KeyValuePair<string, int>("High", high),
                                    new KeyValuePair<string, int>("Medium", medium),
                                    new KeyValuePair<string, int>("Low", low),};

            openClosedChart.DataContext = new KeyValuePair<string, int>[] {
                                    new KeyValuePair<string, int>("Open", open),
                                    new KeyValuePair<string, int>("Closed", closed)};

            assignedUnassignedChart.DataContext = new KeyValuePair<string, int>[] {
                                    new KeyValuePair<string, int>("Assigned", assigned),
                                    new KeyValuePair<string, int>("Unassigned", unassigned)};

            priorityChart.DataContext = new KeyValuePair<string, int>[] {
                                    new KeyValuePair<string, int>("Critical", critical),
                                    new KeyValuePair<string, int>("High", high),
                                    new KeyValuePair<string, int>("Medium", medium),
                                    new KeyValuePair<string, int>("Low", low)};
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {

        }

        private void btnPrintAll_Click(object sender, RoutedEventArgs e)
        {
            PrintDialog printDlg = new System.Windows.Controls.PrintDialog();

            if (printDlg.ShowDialog() == true)
            {

                printDlg.PrintVisual(AllGrid, "All Trouble Reports");

            }
        }

        private void btnPrintOpenClosed_Click(object sender, RoutedEventArgs e)
        {
            PrintDialog printDlg = new System.Windows.Controls.PrintDialog();

            if (printDlg.ShowDialog() == true)
            {

                printDlg.PrintVisual(openClosedGrid, "Open/Closed Trouble Reports");

            }
        }

        private void btnPrintAssignedUnassigned_Click(object sender, RoutedEventArgs e)
        {
            PrintDialog printDlg = new System.Windows.Controls.PrintDialog();

            if (printDlg.ShowDialog() == true)
            {

                printDlg.PrintVisual(assignedUnassignedGrid, "Assigned/Unassigned Trouble Reports");

            }
        }

        private void btnPrintPriority_Click(object sender, RoutedEventArgs e)
        {
            PrintDialog printDlg = new System.Windows.Controls.PrintDialog();

            if (printDlg.ShowDialog() == true)
            {

                printDlg.PrintVisual(PriorityGrid, "Trouble Reports by Priority");

            }
        }

       
    }
}
